package ar.com.tallerdos.smartdinner.business;

import java.util.List;

import ar.com.tallerdos.smartdinner.dao.RubroDao;
import ar.com.tallerdos.smartdinner.model.Rubro;

public class RubroBusiness {
    private static RubroDao dao;
    
    public static Rubro findById(Integer id) {
	return getDao().findById(id);
    }
    
    public static List<Rubro> findAll() {
	return getDao().findAll();
    }
    
    public static void create(Rubro entity) {
	getDao().create(entity);
    }
    
    public static Boolean delete(Rubro entity) {
	return delete(entity.getId());
    }
    
    public static Boolean delete(Integer id) {
	return getDao().delete(id);
    }
    
    public static Boolean update(Rubro entity) {
	return getDao().update(entity);
    }
    
    public static Boolean createOrUpdate(Rubro entity) {
	return getDao().createOrUpdate(entity);
    }

    public static RubroDao getDao() {
	if (dao == null) {
	    dao = new RubroDao();
	}
        return dao;
    }

    public static void setDao(RubroDao dao) {
	RubroBusiness.dao = dao;
    }
}
